import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/pages/index/Index'
import Content from '@/pages/index/Content'
import My from '@/pages/index/My'
import Home from '@/pages/index/Home'
import Borrowing from '@/pages/index/Borrowing'
import Card from '@/pages/index/Card'
import About from '@/pages/about/About'
import Registe from '@/pages/registe/Registe'
import Login from '@/pages/login/Login'
import Product from '@/pages/product/Product'
import DetailInfo from '@/pages/detailInfo/DetailInfo'
import SpreadDetail from '@/pages/spreadDetail/spreadDetail'
import Spread from '@/pages/spread/spread'
import Rules from '@/pages/rules/rules'
import Gift from '@/pages/gift/gift'
import Process from '@/pages/process/process'
import setting from '@/pages/setting/setting'
import Freecard from '@/pages/freecard/freecard'
import CodeInvite from '@/pages/codeInvite/codeInvite'
import CreditcardDetail from '@/pages/creditcardDetail/creditcardDetail'
import message from '@/pages/message/message'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'index',
      redirect: '/index/home',
      component: Index,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    }, {
      path: '/index',
      name: 'index',
      redirect: '/index/home',
      component: Index,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    }, {
      path: '/index',
      name: 'index',
      component: Index,
      children: [
        {
          path: 'my',
          name: 'my',
          component: My
        },{
          path: 'home',
          name: 'home',
          component: Home
        },{
          path: 'borrowing',
          name: 'borrowing',
          component: Borrowing
        },{
          path: 'card',
          name: 'card',
          component: Card
        }
      ],
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    }, {
      path: '/about',
      name: 'about',
      component: About,
      meta: { scrollToTop: true }
    },{
      path: '/content',
      name: 'content',
      component: Content
    }, {
      path: '/login',
      name: 'login',
      component: Login,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    }, {
      path: '/registe',
      name: 'registe',
      component: Registe,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    },{
      path: '/product',
      name: 'product',
      component: Product,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    },{
      path: '/detailInfo',
      name: 'detailInfo',
      component: DetailInfo,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    },{
      path: '/spreadDetail',
      name: 'spreadDetail',
      component: SpreadDetail,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    },{
      path: '/spread',
      name: 'spread',
      component: Spread,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    },{
      path: '/rules',
      name: 'rules',
      component: Rules,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    },{
      path: '/codeInvite',
      name: 'codeInvite',
      component: CodeInvite,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    },{
      path: '/gift',
      name: 'gift',
      component: Gift,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    },{
      path: '/process',
      name: 'process',
      component: Process,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    },{
      path: '/freecard',
      name: 'freecard',
      component: Freecard,
      meta: {
        requireToken: false,
        scrollToTop: true
      }
    },{
      path: '/creditcard',
      name: 'creditcardDetail',
      component: CreditcardDetail,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    },{
      path: '/setting',
      name: 'setting',
      component: setting,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    },{
      path: '/message',
      name: 'message',
      component: message,
      meta: {
        requireToken: true,
        scrollToTop: true
      }
    }
  ]
})
